<div class="smart-rightPanel layui-form">
    <div class="layui-anim layui-anim-upbit">
        <blockquote class="site-text layui-elem-quote">

        </blockquote>
        <table id="list_table" class="layui-hide" lay-filter="mainList"></table>
    </div>
</div>
<script>
    layui.use(['layer', 'table', 'form','jquery'], function () {
        var layer = layui.layer;
        var table = layui.table;
        var form = layui.form;
        var  $ = layui.jquery;
        var tableObj = table.render({
            id: 'list_table'
            , elem: '#list_table'
            , url: 'buss/tixian'
            , where:{tixianStatus:0,userId:getHashParam().id}
            , align: "center"
            , cols: [[ //表头
                {field: 'id', title: '编号',align: 'center',hide:true}
                , {field: 'userName', title: '用户名', width: 140, align: 'center', templet: function (d) {
                        return '<a class="font-primary" href="views/index.html#/buss/user/list[id='+d.userId+']">'+d.userName+'</a>'
                    }}
                , {field: 'name', title: '姓名', width: 140, align: 'center'}
                , {field: 'pirce', title: '金额', width: 140, align: 'center'}
                , {field: 'weixn', title: '微信', width: 140, align: 'center'}
                , {field: 'zhifubao', title: '支付宝', width: 140, align: 'center'}
                , {field: 'bank', title: '银行卡', width: 140, align: 'center'}
                , {field: 'lock', title: '操作', width: 140, templet: function (d) {
                        return '<button class="layui-btn layui-btn-warm layui-btn-sm" lay-event="edit">处理</button>';
                    }, unresize: true, align: 'center'}
            ]]
            , done :function(res,curr,count){
                $(".layui-table-box").find("[data-field='id']").css("display","none");
            }
        });

        $("#search").click(function () {
            reloadTable(tableObj);
        });

        //表格内部操作按钮监听
        table.on('tool(mainList)', function (obj) {
            var data = obj.data;
            var layEvent = obj.event;
            if (layEvent === 'edit') {
                showDialog({
                    title: '修改',
                    template: 'edit',
                    saveUrl: 'buss/tixian/save',
                    tableObj: tableObj,
                    htmlData: data,
                    width : 750
                    ,beforeSubmit: function (data) {
                        if (data.tixianStatus=='-1') {
                            layer.msg("请审核");
                            return false;
                        }
                        return true;
                    }
                })
            }
        });


        // 添加
        $("#save").click(function () {
            showDialog({
                title: '添加'
                , template: 'add'
                , saveUrl: 'buss/tixian/save'
                , tableObj: tableObj
                , width : 1000
            })
        });
    });
</script>

